package cn.fengzhilun.javase.day15;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

public class DemoError {
	
	@Test
	public void testOOM() {
		List<String> list = new ArrayList<>();
		
		for(int i =0; i<10240000; i++) {
			String str = new String(new char[1024]);
			list.add(str);
		}
	}
	
	@Test
	public void test1() {
		foo();
	}
	
	public void foo () {
		System.out.println("aa");
		foo();
	}
	
	@Test
	public void test2() {
		try {
			Files.readAllLines(Paths.get("f:/1.txt"));
		} catch (IOException e) {
			System.out.println("代码捕获异常。");
			e.printStackTrace();
		}
	}
	
	@Test
	public void test3() {
		int a[] = new int [2];
	
		System.out.println(a[4]);
	}
}
